<template>
  <div class="we-chat-login">
    <div class="top">
      <span>微信</span>
      <span @click="handleClose" @mousedown.stop>
        <i class="iconfont wos-close-wechat fs16" />
      </span>
    </div>
    <img class="avatar" src="@/assets/images/weChat/avatar.jpg" alt="avatar" @mousedown.stop />
    <span class="mt18 fs20">木马</span>
    <div class="sign" @click="$emit('sign')" @mousedown.stop>进入微信</div>
    <p>
      <span class="mr34" @mousedown.stop>切换账号</span>
      <span @mousedown.stop>仅传输文件</span>
    </p>
  </div>
</template>

<script lang="ts">
import { defineComponent, inject } from 'vue'

export default defineComponent({
  name: 'weChatLogin',
  emits: ['sign'],
  setup() {
    const childClose = inject<() => void>('childClose')

    const handleClose = () => {
      childClose && childClose()
    }
    return {
      handleClose
    }
  }
})
</script>

<style scoped lang="scss">
.we-chat-login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-color: #fff;

  .top {
    width: 100%;
    display: flex;
    justify-content: space-between;

    span {
      cursor: pointer;
      display: inline-flex;
      justify-content: center;
      align-items: center;

      &:first-of-type {
        color: rgb(167, 166, 170);
        margin-left: 10px;
      }

      &:last-of-type {
        width: 34px;
        height: 26px;
        color: #000;

        &:hover {
          color: #fff;
          background-color: rgb(251, 115, 115);
        }
      }

      .wos-close-wechat {
        font-weight: 500;
        display: inline-block;
        transform-origin: center center;
      }
    }
  }

  .avatar {
    cursor: pointer;
    margin-top: 54px;
    width: 82px;
    height: 82px;
    border-radius: 6px;
    object-fit: contain;
  }

  .sign {
    cursor: pointer;
    margin-top: 61px;
    width: 182px;
    height: 36px;
    background-color: rgb(7, 193, 96);
    color: #fff;
    font-size: 14px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;

    &:hover {
      background-color: rgb(56, 205, 127);
    }
  }

  p {
    font-size: 14px;
    padding-top: 26px;
    color: rgb(67, 104, 149);

    span {
      cursor: pointer;
    }
  }
}
</style>
